/**
 * Created by udi on 2016/9/16.
 */
'use strict'
var jv = require("libjv")

//收缩对象并返回
jv.tidyJson = function (json) {
  if (arguments.length < 2) return json;
  let retJson = {};
  var keys = [];
  if( arguments.length == 2 && arguments[1].Type == "array" ){
    keys = arguments[1]
  }
  else {
      keys = Array.from(arguments).slice(1).intersect(Object.keys(json));
  }

  keys.forEach(key=>{
    var value = json[key];
    if( value === null || typeof(v) === "undefined"){
      return;
    }
    retJson[key] = value;
  });
  return retJson;
};

jv.log = console.log;
jv.error = jv.log;

//Object.assign(exports, jv);
exports.jv = jv;

